/********************************************************************************
 *      Copyright:  (C) 2022 xiezongyi<1764417007@qq.com>
 *                  All rights reserved.
 *
 *       Filename: sqlite3.h
 *    Description:  This head file
 *
 *        Version:  1.0.0(14/05/22)
 *         Author:  xiezongyi <1764417007@qq.com>
 *      ChangeLog:  1, Release initial version on "14/05/22 16:04:33"
 *
 ********************************************************************************/

#ifndef  _SQLITE3_H_
#define  _SQLITE3_H_

#include "sqlite3.h"

typedef struct  sample_data_s
{
    char    ID[16];
    char    datatime[64];
    float   temp;

}sample_data_t;

//创建或打开数据库、建表
int 	database_init(sqlite3 **db, char *db_name);

//插入数据
int	database_insert(sqlite3 *db, char *sample);

//取出第一条记录
int	database_pop_first(sqlite3 *db, char *data);

//删除第一条记录
int	database_delete_first(sqlite3 *db);

//关闭数据库
void	database_term(sqlite3 *db);

//获取第一条数据并填充结构体
int database_get_first(sqlite3 *db, sample_data_t *s_data);

#endif
